from pymodbus.client.sync import ModbusTcpClient as ModbusClient
import logging

#using pymodbus package
#test modbus tcp client

if __name__ == '__main__':
    logging.basicConfig()
    log = logging.getLogger()
    log.setLevel(logging.DEBUG)
    
    mb_client = ModbusClient('127.0.0.1')
    rr = mb_client.read_coils(1,20)
    
    print 'rr',rr